<template>
	<view>
		<view :style="'background-image: url('+get_img+bgFunc()+');'" class="image"></view>

		<view class="title" style="padding-top: 60rpx;">我的收藏</view>



		<view class="huaxing">
			<view class="bg" v-for="(item,index) in list" :key='index'>
				<p>{{item.house.name}}</p>
				<view class="huaxing_">
					<image :src="get_img+item.house.icon" @click="goDetail(item.house_id)"></image>
				</view>
				<view v-if="item.price_state==1">
					<image class="pojia" :src="get_img+'sys/icon/pojia.png'"></image>
				</view>
			</view>
		</view>
	</view>


</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				num: 5,
				sys: {},
				get_img: this.$get_img,

			}
		},
		onLoad() {
			this.sys = uni.getStorageSync("sys")
			this.collect();
		},
		methods: {
			bgFunc() {
				return this.sys.collect_bg != '' ? this.sys.collect_bg : this.sys.sys_background
			},
			collect() {
				let that = this
				this.$model.get('user/common/get_collectList').then(res => {
					if (res.code == 200) {
						that.list = res.data
						for (var i = 0; i < this.list.length; i++) {
							that.list[i].icon = that.get_img + that.list[i].icon
						}
						console.log(that.list)
					}
				})
			},
			goDetail(id) {
				uni.navigateTo({
					url: "../house/house?id=" + id
				})
			}


		}
	}
</script>

<style>
	.huaxing_ image {
		width: 310rpx;
		height: 140rpx;
		margin-top: 10rpx;
		margin-left: 18rpx;
	}

	.pojia {
		width: 80rpx;
		height: 50rpx;
		margin: -410rpx 0 90rpx 0;
	}

	.image {
		background-repeat: no-repeat;
		background-size: cover;
		background-attachment: fixed;
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 100vh;
		z-index: -1;
	}


	.bg {
		height: 80px;
		width: 325rpx;
		border-radius: 4px;
		margin: 40rpx 0 20rpx 10rpx;
		float: left;
		margin-left: 30rpx;
		/* background: #CED7E1; */
		/* background-color: rgba(255, 255, 255, .5); */
	}


	.title {
		color: #fff;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		letter-spacing: 10rpx;
		font-size: 45rpx;
	}

	.huaxing p {
		color: #fff;
		font-size: 30rpx;
		letter-spacing: 5rpx;
		margin-left: 30rpx;

	}

	.huaxing_ {
		width: 100rpx;
		height: 100rpx;
		z-index: 0;
	}
</style>
